package com.cy.pj.log.service;

import com.cy.pj.log.annotation.pojo.SysLog;
import com.cy.pj.log.annotation.service.RemoteLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

//设计思想---Feign远程调用+Async异步调用
//异步写日志--多个线程同时执行请求，不会发生阻塞
@Service
public class AsyncLogService异步处理 { //异步日志service

    @Autowired //把feign接口依赖注入
    private RemoteLogService remoteLogService;//Feign

    @Async //异步调用远端日志服务(不用等待执行结果,同时执行多个请求)
    public void saveLog(SysLog syslog) {
            remoteLogService.saveLog(syslog);
    }
}
